/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Entity;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author itachiu
 */
@Entity
@Table(name = "medical_record")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "MedicalRecord.findAll", query = "SELECT m FROM MedicalRecord m"),
    @NamedQuery(name = "MedicalRecord.findByIdMEDICALRECORD", query = "SELECT m FROM MedicalRecord m WHERE m.idMEDICALRECORD = :idMEDICALRECORD")})
public class MedicalRecord implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "idMEDICAL_RECORD")
    private Integer idMEDICALRECORD;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "medicalRecord")
    private List<Pet> petList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "medicalRecord")
    private List<Vacine> vacineList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "medicalRecord")
    private List<Appointment> appointmentList;

    public MedicalRecord() {
    }

    public MedicalRecord(Integer idMEDICALRECORD) {
        this.idMEDICALRECORD = idMEDICALRECORD;
    }

    public Integer getIdMEDICALRECORD() {
        return idMEDICALRECORD;
    }

    public void setIdMEDICALRECORD(Integer idMEDICALRECORD) {
        this.idMEDICALRECORD = idMEDICALRECORD;
    }

    @XmlTransient
    public List<Pet> getPetList() {
        return petList;
    }

    public void setPetList(List<Pet> petList) {
        this.petList = petList;
    }

    @XmlTransient
    public List<Vacine> getVacineList() {
        return vacineList;
    }

    public void setVacineList(List<Vacine> vacineList) {
        this.vacineList = vacineList;
    }

    @XmlTransient
    public List<Appointment> getAppointmentList() {
        return appointmentList;
    }

    public void setAppointmentList(List<Appointment> appointmentList) {
        this.appointmentList = appointmentList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idMEDICALRECORD != null ? idMEDICALRECORD.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof MedicalRecord)) {
            return false;
        }
        MedicalRecord other = (MedicalRecord) object;
        if ((this.idMEDICALRECORD == null && other.idMEDICALRECORD != null) || (this.idMEDICALRECORD != null && !this.idMEDICALRECORD.equals(other.idMEDICALRECORD))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Entity.MedicalRecord[ idMEDICALRECORD=" + idMEDICALRECORD + " ]";
    }
    
}
